package com.registration.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.registration.bean.LogBean;
import com.registration.mapper.LogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogService {

    @Autowired
    private LogMapper logMapper;

    /**
     * 分页查询日志
     * @param pageNum 页码
     * @param pageSize 每页大小
     * @return 分页结果
     */
    public PageInfo<LogBean> selectLogsByPage( int pageNum, int pageSize) {

        // 设置分页参数
        PageHelper.startPage(pageNum, pageSize);

        // 查询数据
        List<LogBean> logList = logMapper.selectLogsByPage(pageNum,pageSize);

        PageInfo<LogBean> pageInfo = new PageInfo<>(logList);

        // 返回分页信息
        return pageInfo;
    }


}
